import java.util.ArrayList;

public class OperatorDemo2 implements Operator{

    @Override
    public void printmassage(ArrayList<Student> s) {

        int count1 = 0;
        int count2 = 0;
        for (int i = 0; i < s.size(); i++) {
            Student s1 =s.get(i);
            if(s1.getSex().equals("男")) {
                count1++;
            } else  {
                count2++;
            }
            System.out.println(s1.toString());
        }
        System.out.println("男生的人数：" + count1);
        System.out.println("女生的人数：" + count2);

    }

    @Override
    public void printscore(ArrayList<Student> s) {

        double sum = 0;
        double max = s.get(0).getScore();
        double min = s.get(0).getScore();
        for (int i = 0; i < s.size(); i++) {
            Student s1 =s.get(i);
            if(s1.getScore() > max) {
                max = s1.getScore();
            }
            if(s1.getScore() < min) {
                min = s1.getScore();
            }
            sum += s1.getScore();

    }
        System.out.println("全部学生的平均分：" + (sum - max - min) / (s.size() - 2));

    }
}
